<template>
	<view>
		<view class="all">
			<!-- 输入框头部图标 -->
			<uni-easyinput prefixIcon="person"  v-model="user.username" placeholder="请输入账号" @iconClick="onClick"></uni-easyinput>
			<!-- 展示输入框尾部图标 -->
			<uni-easyinput prefixIcon="info-filled" type="password" v-model="user.password" placeholder="请输入密码"></uni-easyinput>
			<uni-easyinput prefixIcon="info-filled" v-model="user.nickname" placeholder="请输入昵称"></uni-easyinput>
			<button class="mini-btn cli_c" @click="update()"  style="margin-top: 50rpx;width: 300rpx;height: 80rpx;font-size: 35rpx;"type="primary" size="mini">修改</button>
		</view>
	</view>
</template>

<script>
import bill from '../../api/pay.js';
export default {
	data() {
		return {
			id: '',
			user: {
				username: '',
				nickname: '',
				password: ''
			}
		};
	},
	onLoad(options) {
		this.id = options.id;
		this.getOneByid();
	},
	methods: {
		getOneByid() {
			bill.getOneByid(this.id).then(res => {
				this.user = res.data.data.user;
				console.log(res.data.data.user);
			});
		},

		update() {
			bill.update(this.user).then(res => {
					// 注册了让他去登录
					uni.switchTab({
						url: '/pages/index/index'
					});
			});
		}
	}
};
</script>

<style scoped lang="less">
.all {

	margin: 50rpx;
	padding: 20rpx;
	display: flex;
	flex-direction: column;
	align-items: center;
}
</style>
